<?php
/**
 * Description: 输出类
 *
 * @author      Eden
 * @datetime    2016/11/24 17:00
 * @copyright   Beijing CmsTop Technology Co.,Ltd.
 */

class ADM_Output extends CI_Output
{
    /**
     *
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * 以 JSON 格式输出内容
     *
     * @param array $response
     */
    public function send(Array $response)
    {
        try {
            $this->set_status_header(200)
                ->set_content_type('application/json', 'utf-8')
                ->set_output(json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES))
                ->_display();
            exit;
        } catch (Exception $e) {
            log_message('error', 'Send output invalid json.');
            exit;
        }
    }

}
